package com.jeegit.ecms.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.jeegit.ecms.mapper.CmsVideoDataMapper;
import com.jeegit.ecms.domain.CmsVideoData;
import com.jeegit.ecms.service.ICmsVideoDataService;
import com.jeegit.common.core.text.Convert;
import com.jeegit.common.utils.IdUtils;

/**
 * 视频详情Service业务层处理
 * 
 * @author jeegit
 * @date 2022-06-27
 */
@Service
public class CmsVideoDataServiceImpl implements ICmsVideoDataService 
{
    @Autowired
    private CmsVideoDataMapper cmsVideoDataMapper;

    /**
     * 查询视频详情
     * 
     * @param id 视频详情主键
     * @return 视频详情
     */
    @Override
    public CmsVideoData selectCmsVideoDataById(Long id)
    {
        return cmsVideoDataMapper.selectCmsVideoDataById(id);
    }

    /**
     * 查询视频详情列表
     * 
     * @param cmsVideoData 视频详情
     * @return 视频详情
     */
    @Override
    public List<CmsVideoData> selectCmsVideoDataList(CmsVideoData cmsVideoData)
    {
        return cmsVideoDataMapper.selectCmsVideoDataList(cmsVideoData);
    }

    /**
     * 新增视频详情
     * 
     * @param cmsVideoData 视频详情
     * @return 结果
     */
    @Override
    public int insertCmsVideoData(CmsVideoData cmsVideoData)
    {
    	cmsVideoData.setId(IdUtils.getInstance(3l).nextId());
    	cmsVideoData.preInsert(cmsVideoData);
        return cmsVideoDataMapper.insertCmsVideoData(cmsVideoData);
    }

    /**
     * 修改视频详情
     * 
     * @param cmsVideoData 视频详情
     * @return 结果
     */
    @Override
    public int updateCmsVideoData(CmsVideoData cmsVideoData)
    {
    	cmsVideoData.preUpdate(cmsVideoData);
        return cmsVideoDataMapper.updateCmsVideoData(cmsVideoData);
    }

    /**
     * 批量删除视频详情
     * 
     * @param ids 需要删除的视频详情主键
     * @return 结果
     */
    @Override
    public int deleteCmsVideoDataByIds(String ids)
    {
        return cmsVideoDataMapper.deleteCmsVideoDataByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除视频详情信息
     * 
     * @param id 视频详情主键
     * @return 结果
     */
    @Override
    public int deleteCmsVideoDataById(Long id)
    {
        return cmsVideoDataMapper.deleteCmsVideoDataById(id);
    }
}
